//
//  MainViewController.m
//  Mtime
//
//  Created by Mac on 15/8/12.
//  Copyright (c) 2015年 wxk. All rights reserved.
//

#import "MainViewController.h"
#import "BaseNavigationController.h"
#import "CustomTabbarController.h"
#import "HomeViewController.h"

@interface MainViewController ()

@end

@implementation MainViewController


//加载试图控制器
+ (void)loadViewControllers {
    
    NSArray *arr = @[@"HomeViewController",@"DiscoverViewController",@"StoreViewController",@"PayTicketViewController",@"MyInfoViewController"];
    
    NSMutableArray *vcs = [[NSMutableArray alloc] initWithCapacity:arr.count];
    
    for (NSString *str in arr) {

        UIViewController *vc = [[NSClassFromString(str) alloc] init];
        
        BaseNavigationController *navi = [[BaseNavigationController alloc] initWithRootViewController:vc];
        
        [vcs addObject:navi];
        
    }
    
    CustomTabbarController *tabbar = [[CustomTabbarController alloc] init];
    
    tabbar.viewControllers = vcs;
    
    
    //获取程序的主窗口  设置窗口足视图
    [[UIApplication sharedApplication].delegate window].rootViewController = tabbar;
    
    HomeViewController *homeVC = tabbar.viewControllers[0];
    
    homeVC.view.transform = CGAffineTransformMakeScale(.2, .2);
    
    [UIView animateWithDuration:1 animations:^{
        
        homeVC.view.transform = CGAffineTransformIdentity;
    } completion:^(BOOL finished) {
        
        
        WXGAlertView *alertView = [[WXGAlertView alloc] initWithFrame:CGRectMake(0, 0, 300, 400)];
        
        [alertView getButtnIndex:^(NSInteger index) {
            
            if (index == 0) {
                
                [[NSNotificationCenter defaultCenter] postNotificationName:@"userInteractionEnabled" object:self];
            }
            
        }];
        
        UIImageView *imageview = [[UIImageView alloc] initWithFrame:alertView.contentView.bounds];
        
        imageview.image = [UIImage imageNamed:@"wizard2_480@2x.jpg"];
        [alertView.contentView addSubview:imageview];
        
        [alertView show];
        
    }];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}

@end
